﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;

/// <summary>
/// Summary description for PaypalProcess
/// </summary>
public class PaypalProcess
{
	public PaypalProcess()
	{
      
	}

    public string GetPaypalProcess(string returnURL, string cancelReturnUrl, string serverURL, string business, string itemName,int itemNumber, float amount)
    {

        //Assigning Cmd Path as Statically to Parameter
        //SetExpressCheckout
        //_xclick
        string cmd = "_xclick";
        //Passing Currency as Statically to parameter
        string currency_code = "USD";
        string redirect = "";
        //Pass your Server_Url,cmd,business,item_name,amount,currency_code variable.		
        if (String.Compare(ConfigurationManager.AppSettings["UseSandbox"].ToString(),"true", false) == 0)
        {
            serverURL = "https://www.sandbox.paypal.com/cgi-bin/webscr?";
        }
        else
        {
            serverURL = "https://www.paypal.com/cgi-bin/webscr?";
        }
        redirect += serverURL;
        redirect += "cmd=" + cmd;
        redirect += "&business=" + business;
        redirect += "&item_name=" + itemName;
        redirect += "&item_number=" + itemNumber;
        redirect += "&amount=" + amount;
        redirect += "&currency_code=" + currency_code;
        redirect += "&return=" + returnURL;
        redirect += "&cancel_return" + cancelReturnUrl;
        return redirect;
    }
}